﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
</head>
<body>
    <p>1:js是没有块级作用域的,if for等等</p>
    <p>var a; 这是没有声明a, 此时a为undefined</p>
</body>
</html>
<script>
    function outPut(s) {
        console.log(s);
    }
    var o = { age: 1 };
    var outer = function() {
        outPut(o.age); // 0 
        function inner() {
            outPut(o.age); //undefiend 
            var o = { age: 2 };
            outPut(o.age); //1 

            function inner2()
            {
                outPut("inner2:" + o.age);
            }
            inner2();
        }
        inner();
        outPut(o.age); //0 
    }
    outer();
</script>
